local ty_1v2_ya = fk.CreateSkill {
    name = "ty_1v2_ya&",
    tags = { Skill.Compulsory },
}

Fk:loadTranslationTable {
    ["ty_1v2_ya&"] = "永安",
    [":ty_1v2_ya&"] = "锁定技，你始终跳过摸牌和弃牌阶段，出牌阶段开始和结束时，若你的体力值不为1，失去一点体力，摸两张牌；当有角色失去体力后，你摸一张牌。",
}

ty_1v2_ya:addEffect(fk.HpLost, {
    mute = true,
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(ty_1v2_ya.name)
    end,
    on_use = function(self, event, target, player, data)
        player:drawCards(1, ty_1v2_ya.name)
    end,
})
ty_1v2_ya:addEffect(fk.EventPhaseChanging, {
    can_refresh = function(self, event, target, player, data)
        return target == player and player:hasSkill(ty_1v2_ya.name) and
            (data.phase == Player.Draw or data.phase == Player.Discard) and not data.skipped
    end,
    on_refresh = function(self, event, target, player, data)
        data.skipped = true
    end,
})

ty_1v2_ya:addEffect(fk.EventPhaseStart, {
    is_delay_effect = true,
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(ty_1v2_ya.name) and
            player.phase == Player.Play and player.hp ~= 1
    end,
    on_use = function(self, event, target, player, data)
        player.room:loseHp(player, 1, ty_1v2_ya.name)
        player:drawCards(2, ty_1v2_ya.name)
    end,
})
ty_1v2_ya:addEffect(fk.EventPhaseEnd, {
    is_delay_effect = true,
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(ty_1v2_ya.name) and
            player.phase == Player.Play and player.hp ~= 1
    end,
    on_use = function(self, event, target, player, data)
        player.room:loseHp(player, 1, ty_1v2_ya.name)
        player:drawCards(2, ty_1v2_ya.name)
    end,
})
return ty_1v2_ya
